<template>
  <div>
    <a-spin tip="Loading..." :spinning="spinning">
      <div class="spin-content">
        正在登陆中。。。。
      </div>
    </a-spin>
  </div>
</template>

<script>
import { mapActions } from 'vuex'
export default {
  name: 'Authredirect',
  created () {
    const params = this.$route.query
    let ticket = params.ticket
    this.loginByTicket(ticket)
  },
  data() {
    return {
      spinning: false
    }
  },
  methods: {
    ...mapActions(['Login']),
    loginByTicket(ticket){
      this.spinning = true
      this.Login(ticket).then(res => {
        this.loginSuccess(res)
      }).catch(err => {
        this.requestFailed(err)
      }).finally(() => {
        this.spinning = false
      })

    },
    loginSuccess (res) {
      this.$router.push({ path: '/' })
      this.isLoginError = false
    },
    requestFailed() {

    }
  }
}
</script>

<style>
</style>
